<?php
declare (strict_types = 1);

namespace app\home\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class User extends Model
{
    public static function addUser($data){
        return self::create($data);
    }

    public static function getUser($data){
        return self::where('username',$data['username'])->whereOr('email',$data['username'])->whereOr('phone',$data['username'])->find()->toArray();
    }

    public static function findUser($openid,$open_type){
        return self::where('openid',$openid)->where('open_type',$open_type)->find()->toArray();
    }

    public static function updateUser($data,$id){
        return self::update($data,['id'=>$id]);
    }
}
